﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using GrainManage.Server.Business;
using GrainManage.Entities.Contact;

namespace GrainManage.Server.Controllers
{
    public class ContactController : BaseController
    {
        private readonly ContactBusiness business = new ContactBusiness();

        public string Index()
        {
            return GetInfo(this, business);
        }

        public string Schema()
        {
            return GetSchema(this, business);
        }

        //************************************************POST************************************************

        [HttpPost]
        public ActionResult GetContactName(InputGetContactName input)
        {
            var result = business.GetContactName(input);
            return Json(result);
        }

        [HttpPost]
        public ActionResult GetContactArea(InputGetContactArea input)
        {
            var result = business.GetContactArea(input);
            return Json(result);
        }

        [HttpPost]
        public ActionResult GetContactAddress(InputGetContactAddress input)
        {
            var result = business.GetContactAddress(input);
            return Json(result);
        }

        [HttpPost]
        public ActionResult GetContactsWithPhoto(InputGetContactsWithPhoto input)
        {
            var result = business.GetContactsWithPhoto(input);
            return Json(result);
        }

        [HttpPost]
        public ActionResult GetContacts(InputGetContacts input)
        {
            var result = business.GetContacts(input);
            return Json(result);
        }

        [HttpPost]
        public ActionResult Insert(InputInsert input)
        {
            var result = business.Insert(input);
            return Json(result);
        }

        [HttpPost]
        public ActionResult Update(InputUpdate input)
        {
            var result = business.Update(input);
            return Json(result);
        }

        [HttpPost]
        public ActionResult Delete(InputDelete input)
        {
            var result = business.Delete(input);
            return Json(result);
        }

        [HttpPost]
        public ActionResult BatchInsert(InputBatchInsert input)
        {
            var result = business.BatchInsert(input);
            return Json(result);
        }

        [HttpPost]
        public ActionResult BatchUpdate(InputBatchUpdate input)
        {
            var result = business.BatchUpdate(input);
            return Json(result);
        }

        [HttpPost]
        public ActionResult BatchDelete(InputBatchDelete input)
        {
            var result = business.BatchDelete(input);
            return Json(result);
        }
    }
}
